import myLocalStorage from '@/utils/localStorage'

const getters = {
  sidebar: state => state.app.sidebar,
  device: state => state.app.device,
  token: state => state.user.token,
  avatar: state => state.user.avatar,
  name: state => state.user.name,
  userInfo: state => state.user.userInfo,
  carTypeList: state => state.static.carTypeList,
  carLoadingTypeList: state => state.static.carLoadingTypeList,
  carStateList: state => state.static.carStateList,
  routeList: state => state.static.routeList,
  warehouseOrderHandleTypeList: state => state.static.warehouseOrderHandleTypeList,
  warehouseSortingRangeList: state => state.static.warehouseSortingRangeList,
  locationAreaTypeList: state => state.static.locationAreaTypeList,
  replenishParseTypeList: state => state.static.replenishParseTypeList,
  purchaseOrderStateList: state => state.static.purchaseOrderStateList,
  supplyGoodsStateList: state => state.static.supplyGoodsStateList,
  purchaseOrderSortTypeList: state => state.static.purchaseOrderSortTypeList,
  organizationPictureTypeList: state => state.static.organizationPictureTypeList,
  organizationTypeList: state => state.static.organizationTypeList,
  supplierDeliveryTypeList: state => state.static.supplierDeliveryTypeList,
  supplierAccountTypeList: state => state.static.supplierAccountTypeList,
  goldExchangeStateList: state => state.static.goldExchangeStateList,
  goodsReturnStateList: state => state.static.goodsReturnStateList,
  goodsReturnDifferenceStateList: state => state.static.goodsReturnDifferenceStateList,
  evaluationFormSortList: state => state.static.evaluationFormSortList,
  potentialCustomerStoreCustomerStateList: state => state.static.potentialCustomerStoreCustomerStateList,
  benefitCardStateList: state => state.static.benefitCardStateList,
  distributionChannelList: state => state.static.distributionChannelList,
  discountMethodsList: state => state.static.discountMethodsList,
  changeLimitOrganizationTypeList: state => state.static.changeLimitOrganizationTypeList,
  goodsCreateSourceList: state => state.static.goodsCreateSourceList,
  paySettlementStatisticSortList: state => state.static.paySettlementStatisticSortList,
  paySettlementStatisticSortListOfChain: state => state.static.paySettlementStatisticSortListOfChain,
  paySettlementStatisticSortListOfWarehouse: state => state.static.paySettlementStatisticSortListOfWarehouse,
  paySettlementStatisticSortListOfStore: state => state.static.paySettlementStatisticSortListOfStore,
  stocktakeTaskStateList: state => state.static.stocktakeTaskStateList,
  stocktakeOrderStateList: state => state.static.stocktakeOrderStateList,
  stocktakeProfitLossReasonList: state => state.static.stocktakeProfitLossReasonList,
  procurementSettlementOrderStatusList: state => state.static.procurementSettlementOrderStatusList,
  procurementSettlementBusinessOrderStatusList: state => state.static.procurementSettlementBusinessOrderStatusList,
  purchaseSettlementOrderSort: state => state.static.purchaseSettlementOrderSort,
  payMethodList(state) {
    const list = state.static.payMethodList
    const customizePayChannelList = myLocalStorage.getJsonItem('customizePayChannelList')
    if (undefined !== customizePayChannelList && customizePayChannelList !== null && customizePayChannelList !== '') {
      for (let i = 0; i < customizePayChannelList.length; i++) {
        list.push({
          name: customizePayChannelList[i].channelName,
          value: 50 + customizePayChannelList[i].channelNumber
        })
      }
    }
    return list
  },
  payChannelList(state) {
    const list = state.static.payChannelList
    const customizePayChannelList = myLocalStorage.getJsonItem('customizePayChannelList')
    if (undefined !== customizePayChannelList && customizePayChannelList !== null && customizePayChannelList !== '') {
      for (let i = 0; i < customizePayChannelList.length; i++) {
        list.push({
          name: customizePayChannelList[i].channelName,
          value: 50 + customizePayChannelList[i].channelNumber
        })
      }
    }
    return list
  },
  stockChangeSortList: state => state.static.stockChangeSortList,
  transactionSortList: state => state.static.transactionSortList,
  transactionSortListOfStore: state => state.static.transactionSortListOfStore,
  businessSortList: state => state.static.businessSortList
}
export default getters
